package com.chen.back.controller;

import com.alibaba.fastjson.JSON;
import com.chen.back.entity.BarVO;
import com.chen.back.entity.PieVO;
import com.chen.back.response.Result;
import com.chen.back.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * @author chen
 * @date @{DATE} -20:14
 **/

@RestController
@RequestMapping("/eCharts")
public class EChartsController {

    @Autowired
    private UserService userService;

    @GetMapping("/barVo")
    public String barVO(){
        BarVO vo = userService.barVOList();
        return JSON.toJSONString(new Result().setCode(200).setData(vo));

    }

    @GetMapping("/pieVo")
    public String pieVO(){
        List<PieVO>  peiList=userService.pieList();

        return JSON.toJSONString(new Result().setCode(200).setData(peiList));

    }




}
